#include<iostream>
#include<functional>
#include<Vector>
using namespace std;
int main()
{
	vector<vector<int>>v{ {2,4,5,6,8},{3,7,9,12} };
	int m = v.size(), n = v[0].size();
	int target = 0; cin >> target;     
	//使用lamba表达式构造check函数
	function<bool(vector<int>&)> check = [&target](vector<int>& nums) {
		//使用二分查找
		int left = 0; int right = nums.size() - 1;
		while (right > left)
		{
			int mid = left + (right - left)/2;//结果在右侧
			if (nums[mid] < target) left = mid + 1;
			else right = mid;
		}
		return target == nums[right];      
	};
	try {
		//遍历数组的每一行
		for (auto& low : v)
		if (check(low))throw "target存在于数组中\n";
		cout << "该数字不存在于数组中" << endl;        
	}                
	catch (const char* s)
	{
		cout << s << endl;    
	}
    return 0;
}
